package com.fanqiechaodan.visitor;

/**
 * @author fanqiechaodan
 * @Classname AnimalCountVisitor
 * @Description 具体访问者;统计个数
 */
public class AnimalCountVisitor implements Visitor{

    private int dogCount;
    private int birdCount;
    private int catCount;

    @Override
    public void visitor(Dog dog) {
        dogCount++;
    }

    @Override
    public void visitor(Cat cat) {
        catCount++;
    }

    @Override
    public void visitor(Bird bird) {
        birdCount++;
    }

    public void printCount(){
        System.out.println("狗的个数:"+dogCount);
        System.out.println("猫的个数:"+catCount);
        System.out.println("鸟的个数:"+birdCount);
    }
}
